home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / Python 1.3 / source code / Mac / mwerks / macuseshlstart.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-12-17  |  844 b   |  30 lines  |  [TEXT/R*ch]

  1. /*
  2. ** mac __start for python-with-shared-library.
  3. **
  4. ** Partially stolen from MW Startup.c, which is
  5. **    Copyright © 1993 metrowerks inc. All Rights Reserved.
  6. */
  7.  
  8. #include <setjmp.h>
  9.  
  10. extern jmp_buf __program_exit;            /*    exit() does a longjmp() to here        */
  11. extern void (*__atexit_hook)(void);        /*    atexit()  sets this up if it is ever called    */
  12. extern void (*___atexit_hook)(void);    /*    _atexit() sets this up if it is ever called    */
  13. extern int __aborting;                    /*    abort() sets this and longjmps to __program_exit    */
  14.  
  15. void __start(void)
  16. {
  17.     char *argv = 0;
  18.     
  19.     if (setjmp(__program_exit) == 0) {    //    set up jmp_buf for exit()
  20.         main(0, &argv);                //    call main(argc, argv)
  21.         if (__atexit_hook)
  22.             __atexit_hook();            //    call atexit() procs
  23.     }
  24.     if (!__aborting) {
  25.         if (___atexit_hook)
  26.             ___atexit_hook();            //    call _atexit() procs
  27.     }
  28. //    ExitToShell();
  29. }
  30.